/*
Christopher Raffaele
02/18/2010
CSC280
Assignement 2 Towers of Hanoi

Tower.cpp
*/

#include"Tower.h"

using namespace std;

//CTOR
Tower::Tower(int numDisks){
	top = NULL;
	size = 0;

	//push values onto the tower in descending order
	for(int i = numDisks; i >= 1; --i){
		Push(i);
	}
}

//operater<<
ostream& operator<<(ostream& os, const Tower& aTower){
	if(aTower.size > 0){
		os << aTower.top->data << " ";

		Tower::Node<int>* temp = aTower.top->next;

		//loop throug nodes to the end, printing out the value as you go
		for(unsigned int i = 1; i < aTower.size; ++i){
			cout << temp->data << " ";
			temp = temp->next;
		}

		temp = NULL;
		delete temp;
	}

	return os;
}